<?php
include("include/config.inc.php");
if(!isset($_SESSION['s_activId']))
{
  $_SESSION['s_urlRedirectDir'] = $_SERVER['REQUEST_URI'];
  header("Location:checkLogin.php");
}
if(isset($_REQUEST['tranSub']))
{
  if(strlen($_REQUEST['transaction']) > 0)
  {
    $insertTransaction = "INSERT INTO transaction(transactionName)
                          VALUES ('".$_REQUEST['transaction']."')";
    $insertTransactionRes = mysql_query($insertTransaction);
  }
}
$tranctionInArray = array();
$i = 0;
$selectTranctionIn = "SELECT transactionName, transactionId
                        FROM transaction";
$selectTranctionInRes = mysql_query($selectTranctionIn);
while($selectTranctionInRow = mysql_fetch_array($selectTranctionInRes))
{
  $tranctionInArray[$i]['transactionId'] = $selectTranctionInRow['transactionId'];
  $tranctionInArray[$i]['transactionName'] = $selectTranctionInRow['transactionName'];
  $i++;
} 
include("./bottom.php");
$smarty->assign('tranctionInArray',$tranctionInArray);
$smarty->display("transaction.tpl");
?>
